package com.s_widget;

import android.os.Bundle;
import android.util.Log;
import android.widget.SeekBar;

import androidx.appcompat.app.AppCompatActivity;

import com.s7.widget.listener.OnDashBoardListener;
import com.s7.widget.widget.DashBoard;

public class DashBoardActivity extends AppCompatActivity implements OnDashBoardListener, SeekBar.OnSeekBarChangeListener {

    private SeekBar seekBar;
    private DashBoard dashBoard;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dash_board);
        seekBar = findViewById(R.id.dash_board_dashboard_seek);
        dashBoard = findViewById(R.id.dash_board_dash);
        dashBoard.setOnListener(this);
        seekBar.setOnSeekBarChangeListener(this);
    }

    @Override
    public void onDashBoard(DashBoard view, float current) {
        Log.e("activity 中选中值回调", String.valueOf(current));
    }

    @Override
    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
        float current = progress  * 240 / 100;
        Log.d("进度", "当前温度：" + current);
        dashBoard.setCurrent(current);
    }

    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {

    }

    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {

    }
}
